<template>
	<view class="page-button">
		<view class="" v-if="hasPermissions">
			<slot name="default">
				
			</slot>
		</view>
	</view>
</template>

<script lang="ts" setup>
	import { computed, withDefaults } from "vue"
	import { storeToRefs } from 'pinia';
	import { useUserInfoStore } from "@/store/useUserInfoStore";
	const userInfoStore = useUserInfoStore();
	const { permissions } = storeToRefs(userInfoStore); // 保持响应式
	import type { RuleButton } from "./types"
	
	const props = withDefaults(defineProps<RuleButton>(), {
		permissionsStr: ""
	})
	
	
	let hasPermissions = computed(() => {
		let target = props.permissionsStr
		return permissions.value.find(item => item == target)
	})
</script>

<style lang="scss" scoped>
</style>